#include "StdAfx.h"

CHelp* Singleton<CHelp>::m_instance = 0;

CHelp::CHelp()
{
	CMpqFile helpTex("yiasedit_keys_new.png");
	D3DXCreateTextureFromFileInMemory(sD3D, helpTex.GetPointer(), helpTex.GetSize(), &m_pHelpTexture);
	m_visible = false;
}

void CHelp::Render()
{
	if(!m_visible)
		return;

	POINT ptSz = sD3D.GetSize();
	Vertex3FRHWT pts[4];
	pts[0].x = ptSz.x / 2.0f - 404;
	pts[0].y = ptSz.y / 2.0f - 242;
	pts[0].u = 0.0f;
	pts[0].v = 0.0f;
	pts[1].x = ptSz.x / 2.0f + 404;
	pts[1].y = ptSz.y / 2.0f - 242;
	pts[1].u = 1.0f;
	pts[1].v = 0.0f;
	pts[2].x = ptSz.x / 2.0f + 404;
	pts[2].y = ptSz.y / 2.0f + 242;
	pts[2].u = 1.0f;
	pts[2].v = 1.0f;
	pts[3].x = ptSz.x / 2.0f - 404;
	pts[3].y = ptSz.y / 2.0f + 242;
	pts[3].u = 0.0f;
	pts[3].v = 1.0f;

	sD3D->SetFVF(VERTEX3FRHWT);
	sD3D->SetTexture(0, m_pHelpTexture);
	sD3D->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, pts, sizeof(Vertex3FRHWT));
}